BSAN2204

Lecture 1 - Introduction to Methods of Business Analytics

Self Introduction: Dr Thomas Magor

I will be your lecturer for BSAN2204 this semester. I have a background in econometrics and consumer choice modelling. My research focuses on the development of models for representing the structures of latent heterogeneity in consumers choices relating in areas such as public transport, travel and tourism. My teaching focuses on developing students skills in R, necessary for their successful completion of the business analytics major. I am the major convenor for business analytics at UQ.


My research

My focus is choice modelling across diverse applications, ranging from public transport, health economics to tourism. I currently writing a paper on the food preferences of those who may be attending the Brisbane 2032 Olympics. I currently supervise two PhD students, both of whom are working in the area of how consumer choice may be affected and driven by artificial intelligence.


I am a co-chair for the 2026 International Choice Modelling Conference (ICMC2026) which will be held on Queensland’s Gold Coast.


Methods of Business Analytics

BSAN2204 – Methods of Business Analytics is the first course in the business analytics major after the course BSAN2201 – Principles of Business Analytics.


The focus of Methods of Business Analytics are the methods of business analytics (the course title does not lie!) used to generate insights that help inform strategic decisions in business problems.


More generally the course focuses on preparing students with the skills they need to complete the business analytics major at UQ and to pursue careers with a strong foundation in the use of analytical methods.

Setting the scene: Money Ball Example

The movie Moneyball is recommended viewing for all BSAN2204 students! In this film, the value of analytics as a way to improve decision making to achieve a desired outcome is really brought to life. The methods in forecasting sporting outcomes are the same as to those used in business and a wide variety of other fields.


The film demonstrates the use of methods of business analytics that are very similar to what is taught here in BSAN2204. It shows how the insights drawn from statistical modelling can significantly improve organisational outcomes (in the films case, optimising the choice of players on a baseball team based on modelling the characteristics of players to maximise game wins).

Moneyball Clip (Video, 4mins7s)



Video not embedded in uploaded lecture file but will be played in live lecture.



Video link: https://www.youtube.com/watch?v=Tzin1DgexlE

Miller, B. (Director). (2011). Moneyball [Film]. Copyright: Columbia Pictures.

BSAN2204 Lectures

Lectures will introduce and demonstrate methods of analytics in R. Some students may benefit from executing the lecture code as we go during lectures, although experience has shows that watching, observing and listening tends to be a more conductive learning experience.


Lectures are nominally 2 hours long. Students should feel free to stop me to ask questions at any point during my lectures, as we will have plenty of time during lectures.

BSAN2204 Tutorials

The accompanying tutorial series will apply the lecture content through a series of practical exercises using the dataset required for the first two assignments.


To some extent (although not completely) your participation and completion of the tutorial exercises will provide you with a nearly complete template .Rmd file needed to generate the .html for Predictive Analytics Report (A2), and as a template which can be used for the final Practical Demonstration (A3) assignment.

Assessments in BSAN2204



Assessment Task AI usage Due Weighting Learning Objectives
R Skills Tutorial Quiz (A1) Forbidden Week 6: Dduring your tutorial 20% 1, 2, 3
Predictive Analytics Report (A2) Acceptable Week 12: 22/05/2026 4:00 pm 50% 2, 3, 4, 5
Practical Demonstration (A3) Encouraged Exam period: Date TBA 30% 3, 4, 5


These three assessment are designed to test both your basic knowledge acquisition of the basics of R, as well your practical skills and ability to generate business analytics reports using R.

Use of AI in BSAN2204

The use of artificial intelligence (AI) has rapidly become an indispensable tool in the field of business analytics. You can and should use AI to troubleshoot your code (particularly in the area of customising the aesthetics of plots/visualisations), and to aid in the writing and interpretation of data.


AI does not replace a requirement to understand the basics of business analytics. In this course, you fundamentally must know and understand how to use R without relying on AI for all your tasks. This means being able to confidently perform basic tasks such as starting a new R project, or troubleshoot basic errors without resorting to immediately “asking” an AI chat bot for help!

R Skills Tutorial Quiz (A1)

The R Skills Tutorial Quiz (A1) occurs during tutorials as a paper based assessment testing basic knowledge about R as a tool for business analytics taught in the first part of the of the course.


This assessment requires students to internalise the basics of R which necessary to independently start an R project, critique R syntax and/or troubleshoot basic R errors without a reliance on AI tools. The feedback students receive on this early piece of assessment is intended to sign post which of their R skill development areas they need to address before being able to confidently and independently get started on the Predictive Analytics (A2) and for completing the final Practical Demonstration (A3).

Predictive Analytics Report (A2)

The Predictive Analytics Report (A2) is a written HTML file (*.html) report using R Markdown that documents an analysis of a dataset provided in class: the Million Song Dataset (MSD).

The report includes the following sections:

  1. Introduction
  2. Exploratory Analysis
  3. Predictive Analytics
  4. Recommendations


The introduction and exploratory analysis section comprises reading and processing a subset of a data frame provided in class (the MSD.rdata file available on Blackboard) into training and test data, and producing tables of descriptive statistics of selected variables for the training data and generating visualisations for justified variables for the training data. The predictive analytics section comprises specifying several different competing linear regression models of the training data, using imputation methods to deal with missing data in both the training and test data and using split sample model cross validation methods to predict observations in the the test data. The recommendations section comprises making predictions (forecasts) of estimated “song hotness” for songs which do not exist in the MSD, with the aim to rank order songs for potential inclusion a song recommendation algorithm.

Practical Demonstration (A3)

The Practical Demonstration (A3) is an observed form of assessment. Students will be given access to a unique dataset on BlackBoard at the start of the assessment time and a briefing written in the form of an email from a hypothetical business analytics colleague/client asking for “request for a quick data summary and analysis”. The task requires students to produce a minimally formatted HTML file (*.html) report using R Markdown under observation that includes descriptive statistics, visualisations and a regression model with concise interpretations using the data provided. Students must complete their response to the client briefing under observation within the time constraint of an examination setting.


To mirror the tools and challenges of a professional work setting, students will be permitted to access the Internet and use AI tools during the assessment time to assist in the completion of the assessment. This assessment evaluates practical skills related to data exploration and predictive analytics, adaptability, and proficiency in using real-world tools under time constraints.

Learning Objectives

After successfully completing this course, you should be able to:

  1. Knowledge: Define the role of R for business analytics.

  2. Comprehension: Recognise and explain the basic concepts used in R for managing and manipulating data.

  3. Application: Apply R for basic business analytics tasks, including data visualisation and predictive analytics/forecasting.

  4. Analysis and Evaluation: Compare and critically evaluate competing methods of business analytics.

  5. Synthesis: Prepare and formulate a business analytics report that informs and improves managerial decision making.

Learning Resources

The course notes (lecture and tutorial slides) provide all the necessary content needed to complete the course. The following text was used in the formulation of in-class examples (including code). Students may find this text useful to refer to for extra information.


Recommended textbook:

Robert I. Kabacoff. R in Action, Third Edition: Data Analysis and Graphics with R and Tidyverse. Shelter Island, NY: Manning, 2022. ISBN 9781617296055

What are methods of business analytics?

Methods of business analytics relate to the tools we use to analyse business relevant data. We will focus on the use of R for this purpose, beginning with how to setup the software, how to read data, methods for processing data, methods for describing and visualising data, and methods of using predictive analytics (including regression, dealing with missing data and model validation).


Statistics are one of the most important tools used in business analytics. As such we will cover several statistical concepts (such as “statistical significance”) in this course. A strong background in statistics is not a prerequisite to do well in this course, but it is important to be aware that we will be working in this space.

What are != methods?

Methods are the techniques and approaches that you use to analyse data, such as regression analysis, clustering, or time series analysis.


Things like formulating a business analytics strategy, policy setting using analytics or the more social/ethical dimensions of using data != methods of business analytics. These are all important aspects of being an effective business analyst, but these are not the focus of this course.

Statistics in business analytics

Statistics are used to translate raw data into actionable insights for business. Reliable statistics are essential as they reduce risk for decision makers, and help businesses account for variability in what drivers their important outcomes.


The types of statistics covered in this course include descriptive statistics (used for summarising the contents of datasets) and predictive analytics (used for to understand and forecast outcomes).

Tools for statistical modelling

There are several tools commonly used in business analytics for statistical analysis. The table below lists what are perhaps the top three most common tools used. In BSAN2204, we will focus our attention on the use of R given our focus is on statistical modelling.


Tool Strengths Ideal For
Excel Ubiquitous, intuitive, good for quick summaries Small-scale analysis, prototyping
R Powerful for all forms of statistical modelling and visualising data Statistical analysis, report generation
Python Flexible, scalable, integrates with automation pipelines Data pipelines, programs, dashboards

Excel

Microsoft’s Excel product has long been the standard go to piece of software for basic data analysis in organisations. Released on 30 September 1985, Microsoft’s Excel has now turned 40 years old.


Excel, and related platforms like Google Sheets, play an important role in business analytics. Data from stakeholders will often be delivered in spreadsheet like formats (e.g., .csv files). Opening, viewing and performing quick tasks like filtering or sorting for initial data review is often done in a spreadsheet first before importing into other pipelines.

R

R is open source statistical programming language. It is widely used in academia and industry whenever robust statistical analysis is required.


R is the preferred language of choice in business analytics whenever statistical analysis is required. It is often used in conjunction with python, especially when the statistical analysis is combined with an automation pipeline.


We will focus exclusively on R in this course to explore statistics relevant to methods of business analytics.

Python

Python is open source general purpose computer programming language. Whilst it can be used for statistical analysis, it is not optimised for this purpose.


Python integrates well with tools like Excel, databases, and cloud platforms make it ideal for automated workflows.


Python is not ideal for statistical analysis as it does not have built in capabilities (it requires installation of additional libraries for things like regression, and more lines of code to setup analyses).


Analytics toolkits

Many business analysts and data scientists use a tool kit comprising both R and python (…and to a lesser extent Excel, too).


R is used for statistical modelling and whilst Python will be used for production ready pipelines, automation, and integration with dashboards.


Excel might be used for “back of the envelope” style calculations, to quickly view a dataset, or to write a quickly format a data table to paste into an email.

Learning R

We will start from scratch in the next session with R. We spend a short amount of time showing how to install R and its companion software R Studio. We will spend the majority of the next session demonstrating how to interact with different types of R objects.


No prior experience using R or other languages is necessary or expected, nor is any background in statistics or quantitative analysis. By the end of the course you will have developed a familiarity for working R in the R Studio environment, specifically within R Markdown files for generating business analytics reports.


Whilst the lecture slides and tutorial slides will contain R code blocks, experience shows students develop a deeper understanding by typing out the code rather than copying and pasting examples.

R Markdown

We will also learn R Markdown in this course. R Markdown is a powerful tool used for combining code, narrative text, and visualisations together to generate reproducible documents, reports and presentations (like this one). This is one of the most important jobs of a business analyst.


The ability to generate reports reproducibly is one of the key strengths of working with R, and specifically with working with R Markdown.


Quick Demonstration of R

R is syntax based. Syntax which generate outputs will display as raw console output.


2 + 2
[1] 4


More often, the analyst will assign outputs to objects for later retrieval—this allows reuse, inspection, and integration into other workflows (e.g., tables, plots, or models).


library(knitr)
row1 <- c(1, 2, 3, 4, 5)
row2 <- c("a", "b", "c", "d", "e")
rbind(row1, row2) |> kable()
row1 1 2 3 4 5
row2 a b c d e

Demonstration of R for basic analysis

The previous examples showed using R to perform basic arithmetic (addition), some basic data creation (numeric and character vectors). It also showed using a base R command rbind (row bind) to combine the two vectors together. Finally, a library (knitr) was loaded from which a function (kable) was used to output a professionally appearing table to this document.


This describes the basic operation of R, being an object based language.


By contrast, python is an interpreted language. The examples on the following slide illustrate the difference.

Differences between R and python

Unlike R, Python does not use formula syntax or object classes like data.frame or matrix by default. Instead, it relies on external libraries (e.g., pandas) to structure and format data.


Python is much more procedural and modular in nature, where functionality is extended through packages and explicit method calls.


For statistical analysis, python is much more verbose as it requires more lines of code and use of external packages, even for simple analysis. Whereas in R, everything from basic to highly advanced statistics is possible with simple commands.


R too has a wealth of extra packages for more specialised tasks, several of which we will make use of. For most analysis, we can use built in base R functions.

Basic statistics in R

R is much easier to use for statistical analysis with its built in functions for basic tasks. The following example uses slightly more complicated R functions to generate 100 rows of data which follow a normal distribution (with a mean of 170 and standard deviation of 10). The mean() function is then used to calculate the mean of the observations stored in the object called height.


The output generated by the mean() function is then shown as raw console output upon execution.


heights <- rnorm(100, mean = 170, sd = 10)
mean(heights)
[1] 169.309

Reporting Values in Documents

When writing business analytics reports, presentation is everything. The typical workflow begins with viewing raw console output during analysis.
To ensure reports are readable, professional, and tailored to their audience in a business analytics report, the analyst should not include commands that produce unformatted console output. Instead, results should be presented using:

  • Inline code for key values
  • Formatted tables for structured data
  • Data Visualisations for patterns and comparisons

These principles are essential for your BSAN2204 assignments. We’ll cover each reporting method in detail during the R Markdown sessions.

Basic data visulisation

One of the main strengths of R is its ability to easily visualise data. With base R packages, we can create visualisations such as histograms, scatter plots, and line graphs with ease. For example, here is how to plot the distribution of values stored in the height object created above (as well including some basic aesthetics):


hist(heights, 
     main = "Distribution of Heights", 
     xlab = "Height (cm)", 
     ylab = "Frequency",
     col = "skyblue")

Powerful data visualisation

R can create powerful and interactive visualisations. The following example uses the plotly package. This plot is probably not very useful as it is overly complex, but it demonstrates the power of R’s graphics capability.


library(plotly)
my_subset <- MSD[1:1000, c("tempo", "loudness", "duration", "song_hotttnesss")]
x_var <- my_subset$tempo
y_var <- my_subset$loudness
z_var <- my_subset$duration
color_var <- my_subset$song_hotttnesss

# Create the 3D scatter plot
plot_ly(data = my_subset,         
    x = ~x_var,         
    y = ~y_var,         
    z = ~z_var,         
    color = ~color_var,         
    colors = colorRamp(c("blue", "red")),         
    type = "scatter3d",         
    mode = "markers") %>%  
   layout(title = "3D Scatter Plot of Million Song Dataset",         
    scene = list(xaxis = list(title = "Tempo"),                      
    yaxis = list(title = "Loudness"),                      
    zaxis = list(title = "Duration")))

Generating reports

R Markdown is used to create dynamic reports that combine code, output, and narrative text. All the course slides in BSAN2204 are created using R Markdown and rendered (“knit”) to .html files. Students in BSAN2204 will also write their assignments the same way, i.e., R Markdown to generate .html report files.


The main advantage of this method of report writing is so we do not need to manually create tables or copy and paste charts and figures in word processors.


Another advantage is that documents can be easily updated with new results by simply re-running the code on new or changed data to regenerate the report, which is particularly useful for reports that need to be generated regularly.

Preparing for the next class

Get ready for our next class by installing R ad R Studio ahead of time. This will enable you to more easily follow along with the in-class R code examples. We will spend some time at the beginning of the next class troubleshooting any problems that may have been encountered.


Step 1: Install R https://cran.csiro.au/


Step 2: Install RStudio https://posit.co/download/rstudio-desktop/

BSAN2204 Teams Page

If you have any further questions after class, please feel free to come chat to me in person (if we have time left in the session).


Otherwise, join us on the BSAN2204 Teams site:


BSAN2204 Teams Page

BSAN2204 Consultation

I will be available for consultation on Fridays from 11am to 12pm. I will not always be in my office between these times, so please ensure you make an appointment via my bookings page (use the link below):


Thomas Magor Consultation Booking Page

Thank you!